package com.supersit.GZFDA.app;

import java.util.List;

import android.app.Application;
import android.widget.TextView;

import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.supersit.GZFDA.entity.Business;
import com.supersit.GZFDA.util.CatchContextException;
import com.supersit.GZFDA.util.CrashHandler;

public class MyApp extends Application {
	public LocationClient mLocationClient;// 定位SDK的核心类
	public TextView mLocationResult;
	public MyLocationListener mListener;
	public static MyApp instance;
	private List<Business> businesss;

	@Override
	public void onCreate() {
		super.onCreate();
		// 程序错误崩溃处理
//		CatchContextException catchContextException = CatchContextException
//				.getInstance();
//		catchContextException.init(getApplicationContext());
		// 百度定位
		mLocationClient = new LocationClient(this.getApplicationContext());
		mListener = new MyLocationListener();
		mLocationClient.registerLocationListener(mListener);
	}

	/**
	 * 实现实位回调监听
	 */
	public class MyLocationListener implements BDLocationListener {

		@Override
		public void onReceiveLocation(BDLocation location) {
			// TODO Auto-generated method stub
			StringBuffer sb = new StringBuffer();
			if (location.getLocType() == BDLocation.TypeGpsLocation) {// 通过GPS定位

			}
		}

	}

	public static MyApp getInstance() {
		if (instance == null) {
			synchronized (MyApp.class) {
				if (instance == null) {
					instance = new MyApp();
				}
			}
		}
		return instance;
	}

	public List<Business> getBusinesss() {
		return businesss;
	}

	public void setBusinesss(List<Business> businesss) {
		this.businesss = businesss;
	}

}
